import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    location: {
      "name": "北京",
      "id": "101010100",
      "lat": "39.90499",
      "lon": "116.40529",
      "adm2": "北京",
      "adm1": "北京市",
    },
    weather: {
      "code": "200",
      "updateTime": "2020-06-30T22:00+08:00",
      "fxLink": "http://hfx.link/2ax1",
      "now": {
        "obsTime": "2020-06-30T21:40+08:00",
        "temp": "24",
        "feelsLike": "26",
        "icon": "101",
        "text": "多云",
        "wind360": "123",
        "windDir": "东南风",
        "windScale": "1",
        "windSpeed": "3",
        "humidity": "72",
        "precip": "0.0",
        "pressure": "1003",
        "vis": "16",
        "cloud": "10",
        "dew": "21"
      },
    },
    sevenday: {
      "code": "200",
      "updateTime": "2021-11-15T16:35+08:00",
      "fxLink": "http://hfx.link/2ax1",
      "daily": [
        {
          "fxDate": "2021-11-15",
          "sunrise": "06:58",
          "sunset": "16:59",
          "moonrise": "15:16",
          "moonset": "03:40",
          "moonPhase": "盈凸月",
          "moonPhaseIcon": "803",
          "tempMax": "12",
          "tempMin": "-1",
          "iconDay": "101",
          "textDay": "多云",
          "iconNight": "150",
          "textNight": "晴",
          "wind360Day": "45",
          "windDirDay": "东北风",
          "windScaleDay": "1-2",
          "windSpeedDay": "3",
          "wind360Night": "0",
          "windDirNight": "北风",
          "windScaleNight": "1-2",
          "windSpeedNight": "3",
          "humidity": "65",
          "precip": "0.0",
          "pressure": "1020",
          "vis": "25",
          "cloud": "4",
          "uvIndex": "3"
        },
        {
          "fxDate": "2021-11-16",
          "sunrise": "07:00",
          "sunset": "16:58",
          "moonrise": "15:38",
          "moonset": "04:40",
          "moonPhase": "盈凸月",
          "moonPhaseIcon": "803",
          "tempMax": "13",
          "tempMin": "0",
          "iconDay": "100",
          "textDay": "晴",
          "iconNight": "101",
          "textNight": "多云",
          "wind360Day": "225",
          "windDirDay": "西南风",
          "windScaleDay": "1-2",
          "windSpeedDay": "3",
          "wind360Night": "225",
          "windDirNight": "西南风",
          "windScaleNight": "1-2",
          "windSpeedNight": "3",
          "humidity": "74",
          "precip": "0.0",
          "pressure": "1016",
          "vis": "25",
          "cloud": "1",
          "uvIndex": "3"
        },
        {
          "fxDate": "2021-11-17",
          "sunrise": "07:01",
          "sunset": "16:57",
          "moonrise": "16:01",
          "moonset": "05:41",
          "moonPhase": "盈凸月",
          "moonPhaseIcon": "803",
          "tempMax": "13",
          "tempMin": "0",
          "iconDay": "100",
          "textDay": "晴",
          "iconNight": "150",
          "textNight": "晴",
          "wind360Day": "225",
          "windDirDay": "西南风",
          "windScaleDay": "1-2",
          "windSpeedDay": "3",
          "wind360Night": "225",
          "windDirNight": "西南风",
          "windScaleNight": "1-2",
          "windSpeedNight": "3",
          "humidity": "56",
          "precip": "0.0",
          "pressure": "1009",
          "vis": "25",
          "cloud": "0",
          "uvIndex": "3"
        }
      ],
      "refer": {
        "sources": [
          "QWeather",
          "NMC",
          "ECMWF"
        ],
        "license": [
          "QWeather Developers License"
        ]
      }
    },
    address: {
      "code": "200",
      "poi": [
        {
          "name": "景山公园",
          "id": "10101010012A",
          "lat": "39.91999",
          "lon": "116.38999",
          "adm2": "北京",
          "adm1": "北京",
          "country": "中国",
          "tz": "Asia/Shanghai",
          "utcOffset": "+08:00",
          "isDst": "0",
          "type": "scenic",
          "rank": "67",
          "fxLink": "https://www.qweather.com"
        },
        {
          "name": "静思园",
          "id": "10119040702A",
          "lat": "31.15999",
          "lon": "120.68000",
          "adm2": "苏州",
          "adm1": "苏州",
          "country": "中国",
          "tz": "Asia/Shanghai",
          "utcOffset": "+08:00",
          "isDst": "0",
          "type": "scenic",
          "rank": "86",
          "fxLink": "https://www.qweather.com"
        }
      ],
      "refer": {
        "sources": [
          "QWeather"
        ],
        "license": [
          "QWeather Developers License"
        ]
      }
    },
    tqzs:{
        "code": "200",
        "updateTime": "2021-12-16T18:35+08:00",
        "fxLink": "http://hfx.link/2ax2",
        "daily": [
          {
            "date": "2021-12-16",
            "type": "1",
            "name": "运动指数",
            "level": "3",
            "category": "较不宜",
            "text": "天气较好，但考虑天气寒冷，风力较强，推荐您进行室内运动，若户外运动请注意保暖并做好准备活动。"
          },
          {
            "date": "2021-12-16",
            "type": "2",
            "name": "洗车指数",
            "level": "3",
            "category": "较不宜",
            "text": "较不宜洗车，未来一天无雨，风力较大，如果执意擦洗汽车，要做好蒙上污垢的心理准备。"
          }
        ],
        "refer": {
          "sources": [
            "QWeather"
          ],
          "license": [
            "QWeather Developers License"
          ]
        }
      }
  },
  getters: {
  },
  mutations: {
    updateLocationMutation(state, location) {
      state.location = location
    },
    // updateHourWeatherMutation(state,hourDate){
    //   state.hourWeatherData = hourDate
    // }
  },
  actions: {
    updateLocationAction(context, location) {
      context.commit("updateLocationMutation", location)
    },

  },
  modules: {
  }
})
